﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Fast.Extensions.DatabaseAccessor.EntityFrameworkCore
{
    [Table(nameof(Tenant))]
    public class EFCoreTenant : Tenant, IEntity<MultiTenancyDbContextLocator>
    {
        /// <summary>
        /// 租户Id
        /// </summary>
        [Key]
        [ScaffoldColumn(false)]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public override int TenantId { get; set; }

        /// <summary>
        /// 租户名
        /// </summary>
        [Required, MaxLength(128)]
        public override string Name { get; set; }

        /// <summary>
        /// 电子邮箱
        /// </summary>
        [EmailAddress, MaxLength(256)]
        public override string Email { get; set; }

        /// <summary>
        /// 手机号码
        /// </summary>
        [Phone, MaxLength(32)]
        public override string PhoneNumber { get; set; }

        /// <summary>
        /// 数据库链接字符串
        /// </summary>
        [MaxLength(256)]
        public override string ConnectionString { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(256)]
        public override string Remark { get; set; }
    }
}
